package nl.hva.three2learn.controller
{
	import flash.events.SyncEvent;
	import flash.net.NetStream;

	import mx.controls.Alert;

	public final class StudentApplicationHandler extends ApplicationHandler
	{
		private var _ns:NetStream;

		public function StudentApplicationHandler(controller:ChatController)
		{
			super(controller);
		}

		override protected function onConnect():void
		{
			super.onConnect();

			so.addEventListener(SyncEvent.SYNC, onBlackboardSync);

			_ns = new NetStream(nc);	
			_ns.play("teacher");

			controller.attachNetStream(_ns);
		}
		
		private function onBlackboardSync(e:SyncEvent):void
		{
			controller.blackboardUpdated(e.target.data.lines);
		}
	}
}
